dimanche 1 juillet 2018

using React Native with Laravel

I need help regarding how to create an react native app of a project which is already made in the Laravel framework. As I am going to make a Laravel website. So I also want to create an IOS and Android app for it. Can anyone suggest me something for it strong text



via Chebli Mohamed

Laravel 5.6 - Route not found

I am using Laravel 5.6 and trying to create a simple form to create a post. I have my web routes that looks like this..

Route::resource('posts', 'PostsController')->middleware('auth');

My form looks like this...

<form action="" method="POST">
    <input name="title" type="text">
</form>

And my PagesController looks like this

public function store(Request $request)
    {
        $page = new Page;
        $title = $request->input('title');
        $page->save();
    }

But I am getting the following error message..

Route [pages@store] not defined

Where am I going wrong?



via Chebli Mohamed

ErrorException Undefined variable while passing variable from controllers to blade file

The index method of my controller is in the image controller. And the view welcome.blade.php is in the image welcome.blade.php. I can't find solution anywhere. What did I do wrong?



via Chebli Mohamed

users and invoices table in a foreach loop

consider a real life situation whereby tenants pays for rent invoices in partial amounts so i am building a system whereby the for loop of payment shows as in the table below, so any help from geeks on how i should go about the layout will be much appreciated, i have tried a foreach loop and currently this is what i have 0

8453

1

8453

2

8453

3

8453

0

7976

0

7382

1

7382

0

5954

1

5954

enter image description here



via Chebli Mohamed

Laravel Translatable factory seeding with dynamic locales

I want to factory seed a translatable model without hardcoding the locales.

There are two values that I have to seed, slug which is not translatable, and title which has to be translated to all the languages from the languages table.

Here is the factory file:

$factory->define(App\Category::class, function (Faker $faker) {

 $counter = 1;
 $locales = Language::pluck('lang'); //returns hr,en,de
 $titles = [];

 foreach ($locales as $locale) {
    $titles[$locale] = [
        'title' => 'Title for category-' .$counter++. ' on '. $locale . ' language'
    ];
 }

/*
$titles = 
     "hr" => array:1 [
        "title" => "Title for category-1 on hr language"
     ]
     "en" => array:1 [
        "title" => "Title for category-2 on en language"
      ...
 */

return [
    'slug' => 'category-'.$counter++,
    $titles
];
});

This gives me an error:

Column not found: 1054 Unknown column 'hr'

Query created by the factory:

insert in to category_translations (locale, hr, en, de, test, category_id) values (0, Title for category-1 on hr language, Title for category-2 on en language, Title for category-3 on de languag e, Title for category-4 on test language, 20))



via Chebli Mohamed

Creating a group with add member with system in laravel

I am developing a project using laravel 5.6 where there is requirement of group, were user can create a group, add member or send invitation to user via email and post to group and can have group chat function also.

I want to complete this module ASAP, so I am looking for laravel packages. I have tried "teamwork" package and "groups" package.

I need some suggestions regarding the package which can be helpful to complete the module ASAP



via Chebli Mohamed

Loop through object within an array Laravel

I'm trying to loop through an object in an array in Laravel.

I made a foreach to loop through my $request->newTags what is an object and I just return the key. my goal is to access each tag_name in my request object what has an array with the multiple indexes what contain the tag_name.

foreach ($request->newTags as $tag) {
   return $tag;
 }

and i get my response enter image description here

how can I access each tag_name?



via Chebli Mohamed