Category : laravel-5

I want to Make a rounded corner image in laravel intervention. Please help me out. $image = Image::make($user[‘profile_pic’])->fit(300, 300, function ($constraint){ $constraint->aspectRatio(); }); $image->encode(‘png’); $width = $image->getWidth(); $height = $image->getHeight(); $mask = Image::canvas($width, $height); // draw a white circle $mask->circle(280, $width / 2, $height / 2, function ($draw) { $draw->background(‘#fff’); }); $image->mask($mask, false); $img->insert($image, ‘top-left’, ..

Read more

I want to Make a rounded corner image in laravel intervention. Please help me out. $image = Image::make($user[‘profile_pic’])->fit(300, 300, function ($constraint){ $constraint->aspectRatio(); }); $image->encode(‘png’); $width = $image->getWidth(); $height = $image->getHeight(); $mask = Image::canvas($width, $height); // draw a white circle $mask->circle(280, $width / 2, $height / 2, function ($draw) { $draw->background(‘#fff’); }); $image->mask($mask, false); $img->insert($image, ‘top-left’, ..

Read more

I have this Category List where i’m creating menu planner this code is working and the output of this code is given below, $categoryList=Category::where(‘user_id’,$id)->get(); $meal_day=array(‘1’=>’Monday’,’2’=>’Tuesday’,’3’=>’Wednesday’,’4’=>’Thursday’,’5’=>’Friday’,’6’=>’Saturday’,’7’=>’Sunday’); $meal_plan=[]; $i= 0; foreach($categoryList as $catKey => $row) { for($k=1;$k<=count($meal_day);$k++) { $menuPlanner=MenuPlanner::where([‘day’=>$k,’user_id’=>auth()->user()->id,’category_id’=>$row[‘id’]])->first(); if($menuPlanner) { $product = Product::where([‘id’=>$menuPlanner->product_id])->first(); $meal_plan[$catKey][$k][‘product_title’]=$product->title; } } } Output: array:2 [ 0 => array:7 [ 1 => ..

Read more

i have error array to string when i uploading multiple image. this is my blade code <form role="form" action="{{ url(‘admin/product’) }}" method="POST" enctype="multipart/form-data"> <input type="file" class="form-control" placeholder="Image Gallery" name="image_gallery[]" required="required" multiple> </form> i already put multiple on input tag and this is the controller code. the commented code "image Gallery" is the code for uploading ..

Read more

In user : public function posts() { return $this->hasMany(Post::class); } In post public function users() { return $this->belongsTo(Users::class); } I handle in controller : $user = Users::find(‘1’)->posts; Then I get an array. And the result returned is exactly what I need But when I query this way, the result is an empty array. What did ..

Read more

I have created my application using laravel and vue.js and hosted my application on server in subfolder inside public_html, Accessing it using url like this: https://maindomain.in/projectfolder/public/login but after login if i click on any link it points back to https://maindomain.in/dashboard and i get 404 not found in console for the api routes that are accessed ..

Read more

$arrList = []; foreach ($product as $val) { $arrList[][‘name’] = $val->name; $arrList[][‘quantity’] = $val->quantity; } return response()->json($arrList); I am a PHP newbie, so I’m not sure how to handle this. I want the name and quantity to be in the same array. To the Vue side get the same result? (2) [{…}, {…}, {…}, {…}, ..

Read more

I am processing in laravel. $product = Product::selectRaw(‘name’)->groupBy(‘name’)->get(); return response()->json($product); Result : (69) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, ..

Read more

I’m new into Laravel and I’m trying to store the user’s company id on a column of the products table each time a user creates a new product. The company’s id it’s retrieved from the user’s session. I’m trying it with Laravel’s Mutator: public function setFirstNameAttribute($value) { $this->attributes[‘company_id’] = session()->get(‘company.id’); } But each time I ..

Read more

//Blade Page @foreach ($permission as $permissions) <tr> <td class="text-center">{{$permissions->id}}</td> <td>{{$permissions->name}}</td> @foreach ($role as $roles) <td class="text-center"> @if ($roles->name == ‘admin’|| $roles->name == ‘superadmin’) <span class="feather feather-check text-success icon-style-circle bg-success-transparent"></span> @else @csrf <input type="hidden" name="name" class="role" value="{{$roles->name}}"> <input type="hidden" name="role_id" class="role_id" value="{{$roles->id}}"> <input type="hidden" class="permissionid" name="permission[]" value="{{$permissions->id}}"> @foreach ($permissionrule as $item) @if ($loop->index) @if ($item == ..

Read more

Result is: function displayAuditTable(data=[]) { var columns = [{data: ‘date’, name: ‘Date’,width:"20%"}, {data: ‘user’, name: ‘User’,orderable : false,width:"20%"}, {data: ‘engagement_profile’, name: ‘Engagement Profile’, orderable : false,width:"20%"}, {data: ‘event’, name: ‘Event’, orderable : false,width:"10%"}, {data: ‘description’,processing: false, serverside: false, "Smart": false, "Regex": true,"Search": " ", orderable: true,width:"30%", searchable: true , name: ‘description’}]; data.order = []; data.sort ..

Read more

I am passing data from vue.js formData.append(‘remark’, this.form.remark); <textarea v-model="form.remark" class="form-control"> </textarea> mounted(){ const header = { ‘Authorization’ : ‘Bearer ‘ + this.getLoginUserData, } this.editId = this.$route.params.id; axios.get(`/api/backend/userdata/${this.editId}` , {headers : header}) .then((response) => { this.form = response.data; form initialization : form: { name: ”, remark: ”, In my controller i’m getting null string and ..

Read more

public function store(Request $request) { $image = [‘http://localhost.loca/image/product/01-1627140249.jpg’, ‘http://localhost.loca/image/product/03-169983334.jpg’]; $product = new Product(); $product->image = json_encode($image); $product->save(); } And the results are stored in the database ["http://localhost.loca/image/product/01-1627140249.jpg","http://localhost.loca/image/product/03-169983334.jpg"] There are being generated. is there any fix. Thanks. Sourc..

Read more

I am working in a user editor, I have a problem, just edit the first record. when I want to edit another different user it sends me data only from the first one public function usuarios(Request $request){ $data = [ ‘category_name’ => ‘apps’, ‘page_name’ => ‘contacts’, ‘has_scrollspy’ => 0, ‘scrollspy_offset’ => ”, ]; $usuarios = ..

Read more

I have an array. Now I save it to the database: public function store(Request $request) { $link = [‘http://localhost.loca/image/img-1627019138.jpg’]; $product = new Product(); $product->link = $link; $product->save(); } And it gives such error: Array to string conversion I want to save it to the database in the form: [‘http://localhost.loca/image/img-1627019138.jpg’] Because it has a lot of ..

Read more

Assuming the model Order class Order extends Model { use HasFactory; protected $table = ‘order’; protected $primaryKey = ‘id’; public $incrementing = false; protected $keyType = ‘string’; protected $guarded = []; public function extra(){ return $this->hasOne(Extra::class); } public function products(){ return $this->hasMany(Product::class); } } and the Model Extra class Extra extends Model { use HasFactory; ..

Read more

I am new to Laravel, I need help with this error: Property [fechaviso] does not exist on this collection instance public function retiro(Request $request) { $data = [ ‘category_name’ => ‘datatable’, ‘page_name’ => ‘miscellaneous’, ‘has_scrollspy’ => 0, ‘scrollspy_offset’ => ”, ]; $registros = Registro::whereNull(‘retiro’) ->whereNull(‘retiro’) ->get(); $hoy = Carbon::now(); $update = Registro::where(‘id’, $request->id)->first(); $registro = ..

Read more