updates 23.08

This commit is contained in:
tmStore 2019-08-23 17:27:39 +05:00
parent 89164f41a9
commit 2725a6fa02
29 changed files with 304 additions and 9 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -40,6 +40,7 @@ class SliderCrudController extends CrudController
['name' => 'page_id', 'type' => 'select', 'entity' => 'page', 'attribute' =>'title', 'model' => 'App\Models\Page',
'lable'=>'Page'],
['name' => 'home','type' => 'boolean', 'lable' => 'Home'],
['name' => 'url','type' => 'text', 'lable' => 'Url'],
['name' => 'img_url','type' => 'text', 'lable' => 'Image'],
['name' => 'alt','type' => 'text', 'lable' => 'Alt'],
@ -48,6 +49,7 @@ class SliderCrudController extends CrudController
$this->crud->addFields([
['name' => 'page_id', 'type' => 'select', 'entity' => 'page', 'attribute' =>'title', 'model' => 'App\Models\Page',
'lable'=>'Page'],
['name' => 'url','type' => 'text', 'lable' => 'Url'],
['name' => 'img_url','type' => 'browse', 'lable' => 'Image'],
['name' => 'alt','type' => 'text', 'lable' => 'Alt'],
['name' => 'home','type' => 'checkbox', 'lable' => 'Home'],

View File

@ -0,0 +1,88 @@
<?php
namespace App\Http\Controllers\Admin;
use Backpack\CRUD\app\Http\Controllers\CrudController;
// VALIDATION: change the requests to match your own file names if you need form validation
use App\Http\Requests\TopheaderadvRequest as StoreRequest;
use App\Http\Requests\TopheaderadvRequest as UpdateRequest;
use Backpack\CRUD\CrudPanel;
/**
* Class TopheaderadvCrudController
* @package App\Http\Controllers\Admin
* @property-read CrudPanel $crud
*/
class TopheaderadvCrudController extends CrudController
{
public function setup()
{
/*
|--------------------------------------------------------------------------
| CrudPanel Basic Information
|--------------------------------------------------------------------------
*/
$this->crud->setModel('App\Models\Topheaderadv');
$this->crud->setRoute(config('backpack.base.route_prefix') . '/topheaderadv');
$this->crud->setEntityNameStrings('topheaderadv', 'topheaderadvs');
/*
|--------------------------------------------------------------------------
| CrudPanel Configuration
|--------------------------------------------------------------------------
*/
// TODO: remove setFromDb() and manually define Fields and Columns
//$this->crud->setFromDb();
$this->crud->addColumns([
['name' => 'page_id', 'type' => 'select', 'entity' => 'page', 'attribute' =>'title', 'model' => 'App\Models\Page',
'lable'=>'Page'],
['name' => 'img_url','type' => 'text', 'lable' => 'Image'],
['name' => 'bottom_img_url','type' => 'text', 'lable' => 'Ashaky adv'],
['name' => 'home','type' => 'boolean', 'lable' => 'Home'],
]);
$this->crud->addFields([
['name' => 'page_id', 'type' => 'select', 'entity' => 'page', 'attribute' =>'title', 'model' => 'App\Models\Page',
'lable'=>'Page'],
['name' => 'url_top','type' => 'text', 'lable' => 'Url top'],
[ // image
'label' => "Yokardaky reklama (2076 x 90)",
'name' => "img_url",
'type' => 'browse'],
['name' => 'alt_top','type' => 'text', 'lable' => 'Alt top'],
['name' => 'url_bottom','type' => 'text', 'lable' => 'Url bottom'],
[ // image
'label' => "Ashaky Reklama",
'name' => "bottom_img_url",
'type' => 'browse'],
['name' => 'alt_bottom','type' => 'text', 'lable' => 'Alt bottom'],
['name' => 'home','type' => 'checkbox', 'lable' => 'Home'],
]);
// add asterisk for fields that are required in TopheaderadvRequest
$this->crud->setRequiredFields(StoreRequest::class, 'create');
$this->crud->setRequiredFields(UpdateRequest::class, 'edit');
}
public function store(StoreRequest $request)
{
// your additional operations before save here
$redirect_location = parent::storeCrud($request);
// your additional operations after save here
// use $this->data['entry'] or $this->crud->entry
return $redirect_location;
}
public function update(UpdateRequest $request)
{
// your additional operations before save here
$redirect_location = parent::updateCrud($request);
// your additional operations after save here
// use $this->data['entry'] or $this->crud->entry
return $redirect_location;
}
}

View File

@ -6,6 +6,7 @@ use App\Http\Requests\ProfileRequest;
use App\Models\Category;
use App\Models\CategoryMaterial;
use App\Models\UserMaterial;
use App\Models\Topheaderadv;
use App\Models\Material;
use App\Models\Order;
use Carbon\Carbon;
@ -32,11 +33,12 @@ class HomeController extends Controller
$materials = Material::orderBy('created_at','desc')
->paginate(6);
$advtopHeader = Topheaderadv::where('home', 1)->first();
return view('main')->with([
'cat' => "",
'materials' => $materials,
'sort' => 'all'
'sort' => 'all',
'advtopHeader' => $advtopHeader,
]);
}

View File

@ -15,6 +15,7 @@ use App\Models\Description;
use App\Models\Advertisement;
use App\Models\Pagead;
use App\Models\Page;
use App\Models\Topheaderadv;
class WebController extends Controller
{
@ -34,7 +35,9 @@ class WebController extends Controller
$adverts = Advertisement::distinct('adv_type')->get();
$advertTop = $adverts->where('adv_type', 'top')->first();
$advertMiddle = $adverts->where('adv_type', 'middle')->first();
$advertBottom = $adverts->where('adv_type', 'bottom')->first();
$advtopHeader = Topheaderadv::where('home', 1)->first();
return view('web.mainWeb')->with([
'sliders' => $sliders,
'news' => $news,
@ -42,7 +45,7 @@ class WebController extends Controller
'bestShows' => $shows,
'advertTop' => $advertTop,
'advertMiddle' => $advertMiddle,
'advertBottom' => $advertBottom,
'advtopHeader' => $advtopHeader,
'showTop2' => $showTop2,
'title' => 'Turkmen Tv',
'keywords' => 'Turkmen Tv',
@ -138,6 +141,9 @@ class WebController extends Controller
$shows = $page->shows;
$advs = $page->pageads;
$programmes = $page->programmes;
$advtopHeader = $page->topheaderadvs->first();
return view('web.pageWeb')->with([
'page' => $page,
'pageSliders' => $pageSliders,
@ -147,6 +153,7 @@ class WebController extends Controller
'title' => $page->title,
'keywords' => $page->keywords,
'meta_description' => $page->meta_description,
'advtopHeader' => $advtopHeader
]);
}

View File

@ -0,0 +1,56 @@
<?php
namespace App\Http\Requests;
use App\Http\Requests\Request;
use Illuminate\Foundation\Http\FormRequest;
class TopheaderadvRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
// only allow updates if the user is logged in
return backpack_auth()->check();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
// 'name' => 'required|min:5|max:255'
];
}
/**
* Get the validation attributes that apply to the request.
*
* @return array
*/
public function attributes()
{
return [
//
];
}
/**
* Get the validation messages that apply to the request.
*
* @return array
*/
public function messages()
{
return [
//
];
}
}

View File

@ -53,6 +53,10 @@ class Page extends Model
public function programmes(){
return $this->hasMany(Programme::class);
}
public function topheaderadvs(){
return $this->hasMany(Topheaderadv::class);
}
/*
|--------------------------------------------------------------------------
| SCOPES

View File

@ -19,7 +19,7 @@ class Slider extends Model
// protected $primaryKey = 'id';
// public $timestamps = false;
// protected $guarded = ['id'];
protected $fillable = ['img_url', 'alt', 'page_id', 'home'];
protected $fillable = ['img_url', 'alt', 'page_id', 'home', 'url'];
// protected $hidden = [];
// protected $dates = [];

View File

@ -0,0 +1,57 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Backpack\CRUD\CrudTrait;
class Topheaderadv extends Model
{
use CrudTrait;
/*
|--------------------------------------------------------------------------
| GLOBAL VARIABLES
|--------------------------------------------------------------------------
*/
protected $table = 'top_header_advs';
// protected $primaryKey = 'id';
// public $timestamps = false;
// protected $guarded = ['id'];
protected $fillable = ['img_url','bottom_img_url', 'page_id', 'url_top', 'url_bottom', 'alt_top', 'alt_bottom', 'home'];
// protected $hidden = [];
// protected $dates = [];
/*
|--------------------------------------------------------------------------
| FUNCTIONS
|--------------------------------------------------------------------------
*/
/*
|--------------------------------------------------------------------------
| RELATIONS
|--------------------------------------------------------------------------
*/
public function page(){
return $this->belongsTo(Page::class);
}
/*
|--------------------------------------------------------------------------
| SCOPES
|--------------------------------------------------------------------------
*/
/*
|--------------------------------------------------------------------------
| ACCESORS
|--------------------------------------------------------------------------
*/
/*
|--------------------------------------------------------------------------
| MUTATORS
|--------------------------------------------------------------------------
*/
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddToSlidersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('sliders', function (Blueprint $table) {
$table->string('url')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('sliders', function (Blueprint $table) {
$table->dropColumn('url');
});
}
}

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTopHeaderAdvsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('top_header_advs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->text('url_top')->nullable();
$table->text('img_url');
$table->string('alt_top')->nullable();
$table->text('url_bottom')->nullable();
$table->text('bottom_img_url');
$table->string('alt_bottom')->nullable();
$table->boolean('home')->default(0);
$table->unsignedInteger('page_id')->nullable();
$table->foreign('page_id')->references('id')->on('pages');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('top_header_advs');
}
}

BIN
public/.DS_Store vendored

Binary file not shown.

BIN
public/top.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 961 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

View File

@ -41,6 +41,9 @@
</div>
<div class="container kesde" style="width: 100%; margin-top: 50px">
<a href=""><img src="{{asset('static/img/okuz.jpg')}}" alt="" style="width: 100%"></a>
{{-- <a href=""><img src="{{asset('static/img/okuz.jpg')}}" alt="" style="width: 100%"></a> --}}
<a href="{{$advtopHeader -> url_bottom}}">
<img src="{{$advtopHeader -> bottom_img_url}}" alt="{{$advtopHeader -> alt_bottom}}" style="width: 100%">
</a>
</div>
@endsection

View File

@ -22,3 +22,4 @@
<li><a href="{{backpack_url('pagead') }}"><i class="fa fa-bookmark"></i> <span>Page Advertisements</span></a></li>
<li><a href="{{backpack_url('programme') }}"><i class="fa fa-table"></i> <span>Programmes</span></a></li>
<li><a href="{{backpack_url('advertisement') }}"><i class="fa fa-home"></i> <span>Home Advertisements</span></a></li>
<li><a href="{{backpack_url('topheaderadv') }}"><i class="fa fa-bullhorn"></i> <span>Top header advs</span></a></li>

View File

@ -1,6 +1,8 @@
<header class="container-fluid">
<div class = "">
<h1 style = "text-align: center;color: #167f7e;font-family: SourceSansSemiBold;padding-bottom: 12px;font-size: 45px;"> 2019-njy ýyl "Türkmenistan-rowaçlygyň Watany" ýyly</h1>
<a href="{{$advtopHeader -> url_top}}">
<img src="{{asset($advtopHeader -> img_url)}}" alt="{{$advtopHeader -> alt_top}}" style="width: 100%">
</a>
</div>
<div class="container-fluid header-menu desktop" style="padding: 0">
<div class="row" style="margin: 0;background-color: #2b9996; height: 77px;">

View File

@ -199,8 +199,8 @@
</div>
</div>
</div></div><div class="tpl-block-list tpl-component-bottomadv" id="nc-block-6defb4ff5eae82edb30bd8e923b820f1"><div id="bottomadv"></div><div class="container kesde" style="width: 100%; margin-top: 30px">
<a href="{{$advertBottom -> url}}">
<img src="{{$advertBottom -> img_url}}" alt="{{$advertBottom -> alt}}" style="width: 100%">
<a href="{{$advtopHeader -> url_bottom}}">
<img src="{{$advtopHeader -> bottom_img_url}}" alt="{{$advtopHeader -> alt_bottom}}" style="width: 100%">
</a>
</div>
</div>

View File

@ -29,4 +29,5 @@ Route::group([
CRUD::resource('pagead', 'PageAdCrudController');
CRUD::resource('page', 'PageCrudController');
CRUD::resource('programme', 'ProgrammeCrudController');
CRUD::resource('topheaderadv', 'TopheaderadvCrudController');
}); // this should be the absolute last line of this file